package com.lll.simple.rpc.registry;

import com.lll.simple.rpc.common.ServiceMeta;

import java.io.IOException;
import java.util.List;

/**
 * @Author: liull
 * @Description: 注册中心接口定义
 * @Date: Created in 14:31 2021/2/3
 * @Modified By:
 */
public interface RegistryService {

    /**
     * 注册服务
     * 
     * @param serviceMeta see @ServiceMeta
     */
    void register(ServiceMeta serviceMeta) throws Exception;

    /**
     * 服务注销
     * 
     * @param serviceMeta see @ServiceMeta
     */
    void unregister(ServiceMeta serviceMeta) throws Exception;

    /**
     * 服务发现
     * 
     * @param serviceName 服务名称
     * @param invokeHashCode 调用的hashcode，一致性hash算法生成
     * @return
     */
    ServiceMeta discovery(String serviceName, int invokeHashCode) throws Exception;

    /**
     * 注册中心销毁
     * 
     * @throws IOException
     */
    void destroy() throws IOException;
}
